package com.dxhackday.ppicker;

import com.dxhackday.ppicker.model.Photo;
import com.dxhackday.ppicker.model.PhotoManager;

import java.io.IOException;
import java.util.LinkedList;

/**
 * @author Sergey Lyadzhin
 * @since 24.11.12 14:39
 */
public class ApplicationContext {
    private static final ApplicationContext INSTANCE = new ApplicationContext();

    public static final String BASE_LIST = "base";
    public static final String GOOD_LIST = "good";
    public static final String BAD_LIST  = "bad";

    public static ApplicationContext getInstance() {
        return INSTANCE;
    }

    private PhotoManager photoManager;
    private int pictureDelayMillis;
    private String outputPath;
    private ApplicationConfig config;


    public void initialize() {
        config = new ApplicationConfig();
        try {
            config.load();
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
    }

    public ApplicationContext(){
        photoManager = new PhotoManager();
        photoManager.addPictureList(BASE_LIST, new LinkedList<Photo>());
        photoManager.addPictureList(BAD_LIST, new LinkedList<Photo>());
        photoManager.addPictureList(GOOD_LIST, new LinkedList<Photo>());
    }
    public PhotoManager getPhotoManager() {
        return photoManager;
    }

    public void setInputPictureList(PhotoManager photoManager) {
        this.photoManager = photoManager;
    }

    public void setPictureDelayMillis(int pictureDelayMillis) {
        this.pictureDelayMillis = pictureDelayMillis;
    }

    public int getPictureDelayMillis() {
        return pictureDelayMillis;
    }

    public ApplicationConfig getConfig() {
        return config;
    }

    public String getOutputPath() {
        return outputPath;
    }

    public void setOutputPath(String outputPath) {
        this.outputPath = outputPath;
    }
}
